<template>
  <div id="app">
    <router-link to="/foo">Go to Foo</router-link>
    <br />
    <router-link to="/foo/12">Go to /user/12</router-link>
    <br />
    <router-link to="/foo/12/profile">Go to /user/12/profile</router-link>
    <br>
    <router-link to="/foo?userId=1">query</router-link>
    <br />
    <router-link to="/other">Go to 404</router-link>
    <br />
    <router-link to="/a">Go to a 重定向到 bar</router-link>
    <br />
    <a href="#/foo">Go to Foo</a>
    <br />
    <button @click="$router.push('foo')">Go to Foo</button><br />
    <router-link to="/bar">Go to 命名视图</router-link> <br />
    <p>{{ routerInfo }}</p>
    <router-view></router-view>
    <router-view name="a"></router-view>
    <router-view name="b"></router-view>
  </div>
</template>
<script>
export default {
  computed: {
    routerInfo() {
      const { fullPath, path, name, params, query, meta } = this.$route
      return {
        fullPath,
        path,
        name,
        params,
        query,
        meta,
      }
    },
  },
}
</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;
}

#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}
</style>
